package com.study.selection.service;

import com.study.selection.dao.ClassesDao;
import com.study.selection.model.Classes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassesServiceImpl implements ClassesService {

    @Autowired
    private ClassesDao classesDao;

    @Override
    public List<Classes> findAll() {
        return classesDao.findAll();
    }

    @Override
    public List<Classes> findByKey(String key) {
        return classesDao.findByKey(key);
    }

    @Override
    public boolean addClass(Classes classes) {
        return classesDao.addClass(classes) > 0 ? true : false;
    }

    @Override
    public List<Classes> getByCollegeId(int collegeId){
        return classesDao.getByCollegeId(collegeId);
    }
    @Override
    public Classes getByClassId(int classesId) {
        return classesDao.getByClassId(classesId);
    }

    public List<Classes> getByMajorId(int majorId){
        return classesDao.getByMajorId(majorId);
    }

    @Override
    public boolean updateClass(Classes classes) {
        return classesDao.updateClass(classes) > 0 ? true : false;
    }
    @Override
    public boolean deleteClass(int classesId) {
        return classesDao.deleteClass(classesId) > 0 ? true : false;
    }


}
